package cn.iocoder.yudao.module.crm.api.encrypt;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.crm.api.encrypt.dto.MobileEncryptConfigDTO;
import cn.iocoder.yudao.module.crm.dal.dataobject.mobileencryptconfig.MobileEncryptConfigDO;
import cn.iocoder.yudao.module.crm.service.mobileencryptconfig.MobileEncryptConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class EncryptMobileApiImpl implements EncryptMobileApi{

    @Resource
    private MobileEncryptConfigService mobileEncryptConfigService;

    @Override
    public MobileEncryptConfigDTO useEncrypt() {
        return BeanUtils.toBean(mobileEncryptConfigService.useEncrypt(), MobileEncryptConfigDTO.class);
    }

    @Override
    public String convertEncryptMobile(MobileEncryptConfigDTO config, String mobile) {
        return mobileEncryptConfigService.convertEncryptMobile(BeanUtils.toBean(config, MobileEncryptConfigDO.class), mobile);
    }
}
